Skip to content

detect CPU cores count and utilize while building project#88

Open
egisz wants to merge 5 commits into
openDsh:developfrom
egisz:multithread
Open

detect CPU cores count and utilize while building project#88
egisz wants to merge 5 commits into
openDsh:developfrom
egisz:multithread

Conversation

@egisz

@egisz egisz commented Aug 4, 2021

Copy link
Copy Markdown
Contributor

Description:

Improve build speed. Detect core count and set accordingly cmake and make command line params.

Checklist:

  • [X ] The code change is tested and works locally.

@icecube45

Copy link
Copy Markdown
Member

Might not be a great idea on pi systems with lower memory (especially with memory split applied), where they lack the memory to properly support the multicore compilation

@egisz

egisz commented Aug 4, 2021

Copy link
Copy Markdown
Contributor Author

I agree, but still it could be beneficial for ones who have more RAM.
It's possible to detect RAM size and limit cores to 2 in case it's < 4GB.

$free -g | grep "Mem:" | awk '{print $2}'

returns RAM size in GB.

What do you think?

@icecube45

Copy link
Copy Markdown
Member

Detection of RAM is a good idea, but I'd adjust the parameters. Personally on my Pi (1GB), I compile with one thread, otherwise there's a chance it freezes up due to memory constraints. Others can chime in here, but I'd adjust the parameters to 1 thread if <1GB

@stefan-sherwood

Copy link
Copy Markdown
Collaborator

I would try compiling it with different threading options and measure the high water mark for memory consumption and adjust the script accordingly.

Now that my change to not require an extreme memory split has been merged, we can probably change the default for everyone.

@rsjudka rsjudka mentioned this pull request Aug 27, 2021
@memtech3

Copy link
Copy Markdown
Contributor

What about making it an interactive option in the install script that defaults to no after 5 seconds with a note not to use it on INSERT SPECS THAT DON'T WORK HERE? Or maybe have it as part of a separate install script?

@akhil11naseem

Copy link
Copy Markdown

This would be useful when cross-compiling for the Pi on a different host (I cross-compile on WSL2 on Windows).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants